package org.homonoia.model.query;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Date;

import org.homonoia.model.core.Status;

public class QueryStatus implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1319995897891338872L;

    private Status jobStatus = null;
    private Date startTime = null;
    private Date endTime = null;

    public QueryStatus(final Status status, final Date startTime, final Date endTime) {
	super();

	setJobStatus(status);
	setStartTime(startTime);
	setEndTime(endTime);
    }

    public final Status getStatus() {
	return jobStatus;
    }

    public final Date getStartTime() {
	return startTime;
    }

    public final Date getEndTime() {
	return endTime;
    }

    public void setJobStatus(final Status jobStatus) {
	this.jobStatus = jobStatus;
    }

    public void setStartTime(final Date startTime) {
	if (startTime != null) {
	    this.startTime = new Date(startTime.getTime());
	}
    }

    public void setEndTime(final Date endTime) {
	if (endTime != null) {
	    this.endTime = new Date(endTime.getTime());
	}
    }

    private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException {
	is.defaultReadObject();
    }

    private void writeObject(ObjectOutputStream os) throws IOException {
	os.defaultWriteObject();
    }
}
